
#ifndef __DSEGEN_H__
#define __DSEGEN_H__

#ifdef DSEGEN_EXPORTS
#define DSEGEN_API __declspec(dllexport)
#define EXPIMP_TEMPLATE
#else
#define DSEGEN_API __declspec(dllimport)
#define EXPIMP_TEMPLATE extern
#endif

#include <set>
#include <vector>

namespace dhis
{
	//------------------------------------------------------------------------------
	//typedef float REAL;
	typedef double REAL;

	//------------------------------------------------------------------------------
	EXPIMP_TEMPLATE template class DSEGEN_API std::set<REAL>;
	EXPIMP_TEMPLATE template class DSEGEN_API std::vector<REAL>;

	//------------------------------------------------------------------------------
	DSEGEN_API typedef enum eSpectralDissimilarityCriterion
	{
		sdcSpectralSDSBSMV,         // The Standard Deviation Sum of Band Spectral Mean Values
		sdcSpectralSQBSMSE,         // Square Root of Band Sum Mean Squared Error

		sdcSpectralTotal,      
		sdcSpectralMin       = sdcSpectralSDSBSMV,
		sdcSpectralMax       = sdcSpectralTotal - 1
	} eSpectralDissimilarityCriterion;

	//------------------------------------------------------------------------------
	DSEGEN_API typedef enum eShapeDissimilarityCriterion
	{
		sdcShapeCompactness,  // Compactness
		sdcShapeFormFactor,     // Form Factor
		sdcShapeAspectRatio,    // Aspect Ratio
		sdcShapeShapeIndex,    // Shape Index

		sdcShapeTotal,      
		sdcShapeMin       = sdcShapeCompactness,
		sdcShapeMax       = sdcShapeTotal - 1
	} eShapeDissimilarityCriterion;

	//------------------------------------------------------------------------------
	DSEGEN_API typedef enum eDataDivideType
	{
		//divideNone  = std::numeric_limits<int>::max(),
		divide32       = 32,
		divide64       = 64,
		divide256     = 256,
		divide512     = 512,
		divide1024   = 1024,
		divide2048   = 2048,
		divide4096   = 4096,
	} eDataDivideType;

	//------------------------------------------------------------------------------
	class DSEGEN_API CParameter 
	{
	public:
		CParameter(void);
		CParameter(const CParameter& other);
		CParameter& operator=(const CParameter& other);
		virtual ~CParameter(void);

		void Normalize();

		bool ExportToXMLFile(const char* szFileName);
		bool ImportFromXMLFile(const char* szFileName);
	public:
		REAL     m_initThreshold;
		int        m_scalePrecision;
		int        m_dataDivideType;
		REAL     m_shapeWeight;
		REAL     m_comptWeight;

		REAL     m_startScale;
		REAL     m_stopScale;
		REAL     m_scaleFactor;

		bool     m_customScale;
		std::set<REAL> m_scales;

		eSpectralDissimilarityCriterion  m_spectralDC;
		eShapeDissimilarityCriterion     m_shapeDC;
	};

	//------------------------------------------------------------------------------
	DSEGEN_API bool  dhisHierarchicalSegment(const char* szInputImageFile,const CParameter& para,const char* szOutPutFolder);
}

#endif





